package net.akcegaraz.tipleague.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;

@Deprecated
public class RequestHandler {

    private String responseText;

    public String getResponseText() {
	return responseText;
    }

    public String loadRound() {
	RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET,
		"round-1.xml");

	try {
	    requestBuilder.sendRequest(null, new RequestCallback() {

		public void onError(Request arg0, Throwable arg1) {
		    arg1.printStackTrace();
		}

		public void onResponseReceived(Request arg0, Response arg1) {
		    responseText = arg1.getText();
		    GWT.log(responseText, null);
		}
	    });

	} catch (RequestException e) {
	    e.printStackTrace();

	}

	return responseText;
    }
}
